<template>
  <div>
    <dynamic-crud
      title="免费出站发售"
      :data="list"
      :option="option"
      :tableLoading="tableLoading"
      :disabled="isRecords"
    ></dynamic-crud>
    <div class="bottom-menu" v-if="isRecords">
      <el-button type="primary" @click="handleCancle" :loading="isSubmit"
        >取 消</el-button
      >
    </div>
  </div>
</template>

<script>
import { queryPastRecords } from "@/api/subwaystm/swstinputpassengerwork/free-work";
export default {
  name: "free-work-records",
  inject: ["passengerWork"],
  data() {
    return {
      list: [],
      isSubmit: false,
      tableLoading: false,
      option: {
        column: [
          {
            label: "闸门被误用张数",
            prop: "gateMisuseNumber",
            type: "number",
          },
	  {
            label: "手机无电张数",
            prop: 'mobileNoeleNumber',
            type: 'number'           
          },
          {
            label: "车票非人损张数",
            prop: "ticketDamageNumber",
            type: "number",
          },
          {
            label: "其它张数",
            prop: "otherNumber",
            type: "number",
          },
          {
            label: "合计",
            prop: "total",
            type: "number",
          },
        ],
      },
    };
  },
  computed: {
    isRecords() {
      return this.boxType == "records";
    },
  },
  props: {
    workInfoRecords: Object,
    boxType: String,
  },
  methods: {
    getList() {
      this.list = [];
      this.tableLoading = true;
      let param = {};
      param.id = this.workInfoRecords.id;
      if(!this.validatenull(this.workInfoRecords.id)){
        queryPastRecords(param)
          .then((response) => {
            this.list = response.data.data;
            this.tableLoading = false;
          })
          .catch(() => {
            this.tableLoading = false;
            this.$message.error("查询失败");
          });
      }else{
          this.tableLoading = false;
      }
    },
    clear() {
      this.list = [];
    },
    handleCancle() {
      this.passengerWork.closeDialogPastRecords();
    },
  },
};
</script>

<style lang="scss" scoped>
.bottom-menu {
  margin-top: 30px;
  display: flex;
  justify-content: center;
}
</style>
